package com.gavel.parser;

import com.gavel.utils.StringUtils;

public class SpecUtils {

    public static final char GRAINGER_SPLIT = '/';

    public static String unit(String text, char split) {
        if (StringUtils.isBlank(text)) {
            return "";
        }

        StringBuilder buf = new StringBuilder();
        for (char c : text.toCharArray()) {
            if ( Character.isDigit(c) || Character.isSpaceChar(c)  ) {
               continue;
            }
            buf.append(c);
            if ( c==split ) {
                buf.delete(0, buf.length());
            }
        }
        return buf.toString();
    }

    public static void main(String[] args) {
        System.out.println(unit("100个/盒", SpecUtils.GRAINGER_SPLIT));
    }

}
